package com;

import java.util.Map;

/**
 * Created by yangsp1 on 16/3/31.
 */
public class MapUtil {
    public static void printMapFields(Map map) throws Exception{
        Object defaultInitialCapacity = BeanUtil.getFieldValue(map,"DEFAULT_INITIAL_CAPACITY");
        System.out.println("defaultInitialCapacity = " + defaultInitialCapacity);

        Object[] table = (Object[]) BeanUtil.getFieldValue(map,"table");
        if(table == null){
            System.out.println("table为空，还没初始化 " );
        } else {
            System.out.println("table.length = " + table.length);
        }

        System.out.println("size = " + map.size());

        Object threshold = BeanUtil.getFieldValue(map,"threshold");
        System.out.println("threshold = " + threshold);

        Object loadFactor = BeanUtil.getFieldValue(map,"loadFactor");
        System.out.println("loadFactor = " + loadFactor);
    }
}
